<?php include("conn.php");?>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<?php include("public/cssjs.php");?>
<title>区域管理</title>
</head>
<body>
<div class="page-container">
    <?php
    if(isset($_GET["id"])){$id=$_GET["id"];}else{$id=1;}
    $conn=new Mysql();
    $sql = "select * from newscata_area where id =".$id;
    $rs =$conn->getRow($sql);
    if($rs)
    {
        $cataid=$rs["CatalogParentId"];
        $title=$rs["title"];
        $SortId=$rs["SortId"];
    }

    ?>
	<form action="" method="post" class="form form-horizontal" id="form-category-add" name="form1">

        <div id="tab-category" class="HuiTab">
			<div class="tabBar cl">
				<span>基本设置</span>
			</div>

                <input type="hidden" class="input-text" value="<?php echo $id;?>" placeholder="" id="uid" name="uid">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						上级栏目：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select class="select" id="sel_Sub" name="sel_Sub" onchange="SetSubID(this);">
							<option value="0">顶级分类</option>
                    <?php ShowSelect(0,"newscata_area",$cataid,6,true) ?>
						</select>

						</span>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						分类名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" value="<?php echo $title;?>" class="input-text"  placeholder="栏目名称" id="title" name="title">
					</div>
					<div class="col-3">
					</div>
				</div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">是否有下级：</label>
                    <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                        <div class="radio-box">
                            <input name="xiaji" type="radio" value="1" id="xiaji-1" checked>
                            <label for="xiaji-1">是</label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="xiaji-2" value="0" name="xiaji">
                            <label for="xiaji-2">否</label>
                        </div>

                    </div>

                </div>


		</div>
		<div class="row cl">
			<div class="col-9 col-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/h-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/h-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#tab-category").Huitab({
		index:0
	});
	$("#form-category-add").validate({
		rules:{
			title:{
				required:true
			}
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var sel_Sub=$("#sel_Sub").val();
			var title=$("#title").val();
			var xiaji=$('input[name="xiaji"]').val();
            var uid=<?php echo $id?>;
			 $.ajax({
                 type: "GET",
                 url: "json/areacata.php",
                 data: {'sel_Sub': sel_Sub, 'title': title, 'xiaji': xiaji,'uid': uid, 'Type': 'edit'},
                 datatype: "json",
                 success: function (data) {

                     		if(data==1){
                     			layer.msg('编辑成功!',{icon:1,time:1000});
                     			var index=parent.layer.getFrameIndex(window.name);

                     			window.parent.location.reload();
                     			parent.layer.close(index);
                     			}else{

                     			layer.msg('系统错误error!',{icon:1,time:1000});
                     				}
                 }
             });

			
		}
	});
});

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>